#!/bin/bash 
#set -x  
shdir=${0%/*}
cd $shdir
shdir=$PWD

PYTHON="python2.6"

today=`date +%Y%m%d`

logdir=$shdir/logs/$today
mkdir -p $logdir

function log(){
    echo -n "LOG "
    echo -n " [" `date` "]"
    echo -n " [" `date +%s` "]"
    echo " $@"
}



log "bengin sync..."


#start checking user and update user info 
log "begin user_checking......"
$PYTHON $shdir/user_checking.py > $logdir/user_checking.log 2>&1
log "end user_checking."

sleep 5

#sync increment items
log "begin sync items increment..."
$PYTHON $shdir/items_inc.py > $logdir/items_inc.log 2>&1
log "end sync items increment."

sleep 5

#sync increment trades
log "begin sync increment trades......"
$PYTHON $shdir/trades_inc.py > $logdir/trades_inc.log 2>&1
log "end sync increment trades."

sleep 5

#sync increment traderates 
log "begin sync increment traderates ......"
$PYTHON $shdir/traderate_inc.py > $logdir/traderate_inc.log 2>&1
log "end sync increment traderates."

sleep 2

log "end sync."







